package com.usian.admin.controller.v1;

import com.usian.admin.service.AdSensitiveService;
import com.usian.api.AdSensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/api/v1/sensitive")
@Api(value = "敏感词管理",tags = "sensitive",description = "敏感词管理API")
public class AdSensitiveController implements AdSensitiveControllerApi {

    @Autowired
    private AdSensitiveService adSensitiveService;

    @PostMapping("/list")
    @Override
    public ResponseResult findByNameAndPage(@RequestBody SensitiveDto dto) {
        return adSensitiveService.findByNameAndPage(dto);
    }
    @PostMapping("/save")
    @Override
    public ResponseResult insert(@RequestBody AdSensitive dto) {
        return adSensitiveService.insert(dto);
    }

    @PostMapping("/update")
    @Override
    public ResponseResult update(@RequestBody AdSensitive dto) {
        return adSensitiveService.update(dto);
    }
    @GetMapping("/del/{id}")
    @Override
    public ResponseResult del(@PathVariable Integer id) {
        return adSensitiveService.del(id);
    }
}
